import { Resolve, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
import { Injectable } from '@angular/core';
import { SongSheet } from '../entity';
import { SongSheetService } from 'src/app/shared';

@Injectable()
export class SheetDetailResolve implements Resolve<SongSheet> {

  constructor(
    private songSheetService: SongSheetService
  ) { }

  resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
    const id = route.paramMap.get('id');
    return this.songSheetService.getSongSheetDetail(Number(id));
  }

}
